<?php

// Defaults
$Sp_Chr = '	';

// File Data
$f = 1;
$log = null;

$handle = fopen($filename, "x");
$TotalReg = $List[0];
$SUM = 0;
$BNFNOTES = '';
for ($y = 1; $y <= $TotalReg; $y++) {
    $acc_type = $List[$y]['TipoCuenta'];
    $log .= ( $CNC + $y) . $Sp_Chr;
    $log .= $List[$y]['ORInternal'] . $Sp_Chr;
    $log .= $List[$y]['BnfNombre'] . $Sp_Chr;
    $log .= preg_replace("#[\-\/\.]#", "", $List[$y]['BnfCedula']) . $Sp_Chr;
    $log .= $List[$y]['bp_Name'] . $Sp_Chr;
    $log .= $List[$y]['cb_Sucursal'] . $Sp_Chr;
    $log .= bpcorrconv($List[$y]['cb_Banco'], $List[$y]['CorrNumero'], $List[$y]['cb_Cuenta'], $List[$y]['cb_TipoCuenta'], $List[$y]['cb_Cuenta_prx'], $List[$y]['cb_Cuenta_sux'], $List[$y]['cb_Cuenta_mod']) . $Sp_Chr;
    $log .= $List[$y]['FraARecibir'] . $Sp_Chr;
    $log .= '' . $Sp_Chr;
    $log .= $acc_type[0] . $Sp_Chr;
    $log .= $List[$y]['FraEnviado'] . $Sp_Chr;
    $log .= $List[$y]['CliNombre'] . $Sp_Chr;
    $log .= $List[$y]['BnfCiudad'] . PHP_EOL;
}

fwrite($handle, $log);
fclose($handle);